import components from '@@/packages';
import { App, Component } from "vue";

type IComponent = Component & {
    install?: (app: App) => void;
};

const install = function (Vue: App) {
    if ((install as any).installed) return;
    components.map((component: IComponent) => typeof component.install === 'function' ? component.install(Vue) : Vue.component(component.name as string, component));
};

if (typeof window !== 'undefined' && (window as any).Vue) {
    install((window as any).Vue);
}
const MoodUI: any = {
    install,
    ...components
};
export default MoodUI;